package util;

import java.util.ArrayList;
import java.util.List;

import books.BookInfo;
import books.Category;

public class ListModelator {
    private ListModelator() {
    }

    // Filters a list by a given category
    public static List<BookInfo> filterListByCategory(final List<BookInfo> list, final Category cat) {
        List<BookInfo> ret = new ArrayList<BookInfo>();

        for (BookInfo it : list) {
            if (it.getCategories().contains(cat)) {
                ret.add(it);
            }
        }

        return ret;
    }

}
